<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Symbol应用</title>
</head>
<body>
    <script>
        // 给对象定义独一无二的属性的时候使用
        let s1 = Symbol('张三');
        let s2 = Symbol('张三');

        let method = Symbol('coding');

        let banji = {
            className:'h220331',
            size:97,
            [s1]:{age:18,sex:'男',hobby:'王者荣耀'},
            "李四":{age:18,sex:'男',hobby:'台球'},
            "王五":{age:17,sex:'男',hobby:'羽毛球'},
            "赵六":{age:28,sex:'男',hobby:'篮球'},
            [s2]:{age:20,sex:'女',hobby:'和平精英'},
            [method]:function(){
                console.log('人人都是coding高手');
            }
        }
        //ASCII 码 unicode码  a z  65 97    321312

        console.log(banji);
        console.log(banji[s1],banji[s2]);
        //调用Symbol定义的方法
        banji[method]();




        // let obj = {
        //     name:'yuonly',
        //     age:198
        // }
        // for(let attr in obj){
        //     console.log(attr, obj[attr]);
        // }
    </script>
</body>
</html>